{% extends 'admin/base.html' %}
{% block head %}
    <meta name="referrer" content="no-referrer">
    <script src="{{ url_for('static', filename='admin/js/item.js') }}"></script>
{% endblock %}
{% block main_content -%}
    <div class="modal fade" id="myModal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel">
        <div class="modal-dialog" role="document">
            <div class="modal-content">
                <div class="modal-header">
                    <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span
                            aria-hidden="true">&times;</span></button>
                    <h4 class="modal-title" id="myModalLabel">科目信息</h4>
                </div>
                <div class="modal-body">
                    <div class="form-group">
                        <div class="input-group">
                            <div class="input-group-addon">名称</div>
                            <input id="name" type="text" class="form-control">
                        </div>
                    </div>
                    <div class="form-group">
                        <div class="input-group">
                            <div class="input-group-addon">链接</div>
                            <input id="url" type="text" class="form-control">
                        </div>
                    </div>

                    <div class="form-group">
                        <div class="input-group">
                            <div class="input-group-addon">种类</div>
                            <input id="cate" type="text" class="form-control">
                        </div>
                    </div>


                    <div class="form-group">
                    </div>
                    <div class="modal-footer">
                        <button type="button" class="btn btn-default" data-dismiss="modal">取消</button>
                        <button id="save" type="button" class="btn btn-primary">确定</button>
                    </div>
                </div>
            </div>
        </div>
    </div>
    <table class="table table-bordered table-striped">
        <thead>
        <tr>
            <th>#</th>
            <th>名称</th>
            <th>链接</th>
            <th>种类</th>
            <th>操作</th>
        </tr>
        </thead>
        <tbody>
        {% for item in items %}
            <tr id="book-info">
                <td>{{ loop.index }}</td>
                <td>{{ item.name }}</td>
                <td>{{ item.url }}</td>
                <td>{{ item.category.name }}</td>
                <td iid="{{ item.id }}">
                    <button class="btn btn-warning btn-xs mod-btn" data-toggle="modal" data-target="#myModal">修改
                    </button>
                    <button class="btn btn-danger btn-xs del-btn">删除</button>
                </td>
            </tr>
        {% endfor %}
        </tbody>
    </table>
    <div class="pagi" style="text-align: center">
        {#        {{ pagination.links }}#}
    </div>
{%- endblock %}